<?php
/**
 * 菜单规则模型
 */
namespace app\common\model;

// 引入框架内置类
use think\facade\Request;
use think\model\concern\SoftDelete;


class Card extends Base
{
    use SoftDelete;
    protected $name = 'card';
    // 定义全局的查询范围
    protected $globalScope = ['status'];

    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    public function scopeStatus($query)
    {
        $query->where('status',1)->field('id,name,store_id,fate,create_time,update_time');
    }
    
    /*public function interests(){
        return $this->hasMany(MembershipInterests::class,"card_key_id");
    }
    public function packageCard(){
        return $this->hasMany(Card::class,)
    }*/
    /*public function getTypeAttr(){
        return $this->type;
    }*/

    

    // 获取父ID选项信息
    /*public static function getList($order = ['id' => 'desc'])//$order = ['weigh', 'id' => 'desc']
    {
        $list = self::order($order)
            ->select()
            ->toArray();
        
        return $list;
    }
    public static function onAfterWrite($user) {
    	\think\facade\Cache::delete('__menu__');
    }
    public function getTitleAttr($value, $data)
    {
    	return lang($value);
    }*/
}